using System;
using Core.Utils;
using Game.Trade;
using UnityEngine;

public class TradeSlot : MonoBehaviour {
    public TradeItem Item {
        get;
        private set;
    }
    
    public void RefreshData(ISellable data,Action<ISellable> onItemClick) {
        if (Item != null) {
            PoolMgr.Ins.Release(Item.gameObject);
        }
        Item = PoolMgr.Ins.Spawn("TradeItem").GetComponent<TradeItem>();
        Item.transform.SetParent(transform);
        Item.transform.localPosition = Vector3.zero;
        Item.Init(data,onItemClick);
    }
}
